<?php
/**
 * vanephp web framework
 * 控制器基类 
 *
 * @author aray <ofree@qq.com>
 * @link http://www.vanephp.com/s
 * @copyright Copyright &copy; 2010 aray
 * @license http://www.vanephp.com/license
 * @package controller
 */

if ( ! defined ( 'INVANE' ) )
	exit ( '!' );

/**
 * 控制器基类 
 * @author aray
 *
 */
class vane_controller {
	/**
	 * 控制器定义变量 
	 * @var array
	 */
	public $vars = array ();
	/**
	 * 控制器
	 * @var string
	 */
	public $controller = '';
	/**
	 * 动作
	 * @var string
	 */
	public $action = '';
	
	public function __construct ( ) {
		$controller = $this->getController ( );
		$action = $this->getAction ( );
	}
	
	/**
	 * 获取当前控制器名称
	 */
	protected function getController ( ) {
		return dispatcher::getController ( );
	}
	/**
	 * 获取当前动作名称
	 */
	protected function getAction ( ) {
		return dispatcher::getAction ( );
	}
	/**
	 * 返回当前控制器内的动作
	 * @param string $action		动作
	 * @param mixed $args			url参数
	 */
	protected function url ( $action, $args = array() ) {
		return url ( $this->getController ( ), $action, $args );
	}
}